# cat_rfs
Replication package for Tomunen, Tuomas. 2025. "Failure to Share Natural Disaster Risk". The Review of Financial Studies (Forthcoming)

## Usage

Run the following in Anaconda prompt (edit path in 1. and 2. based on local configuration):

1. ```cd C:\Users\user\Documents\GitHub\cat_rfs```
2. ```set PYTHONPATH=%PYTHONPATH%;C:\Users\user\Documents\GitHub```
3. ```conda env create --file environment.yml```
4. ```conda activate cat_rfs```
5. ```python main.py [--output paper] [--reconstruct_betas]```
    - If --output paper is included, save tables and figures to cat_rfs/output instead of printing them to console.
    - If --reconstruct_betas is included, recreate betas by running the simulations instead of using the ones provided in betas.csv. Save to cat_rfs/data/betas_reconstructed.csv and use in analyses.
	  Note that peril-specific actuarial probabilities provided in primary.csv are censored for multi-peril bonds due to data licensing limitations.
	  These variables are used in beta simulation, and hence running the script with --reconstruct_betas flag creates fictional betas that don't replicate those in betas.csv. However, the results are largely similar with these recreated betas.
	  Note: simulation requires at least 64GB of RAM to run smoothly, and will still take a long time (~24h).
	  Similarly, some analyses in Table 2, Table 4, and Table 5 use peril-specific actuarial probabilities and hence won't replicate perfectly with censored data. However, all the results remain quantitatively similar.

## Data

- primary.csv
    - Contains primary market data on cat bonds
    - Primary key: CUSIP9 (for international bonds with no CUSIP code, this value is either its CINS code or a substring of its ISIN code)
	- Note: Peril-specific actuarial probabilities (el_[peril], ap_[peril], ep_[peril]) are censored for multi-peril bonds due to data licensing limitations. In particular, their values are set to 1/n * expected_loss, where n is the number of perils the bond is exposed to.
	  These variables are used in beta simulation, and hence running the script with --reconstruct_betas flag creates fictional betas that don't replicate those in betas.csv.
	- Variables:
        - size: Issuance amount in USD. Non-USD bonds are converted using spot rates on first settlement date
        - spread: Spread over benchmark rate
        - maturity: Maturity date
        - pricing_date: Pricing date
        - settle_date: First settlement date
        - attachment_prob: Attachment probability
        - expected_loss: Expected loss
        - exhaustion_prob: Exhaustion probability
        - attachment_prob_wsst: Attachment probability in Warm Sea Surface Temperature scenario
        - expected_loss_wsst: Expected loss in Warm Sea Surface Temperature scenario
        - exhaustion_prob_wsst: Exhaustion probability in Warm Sea Surface Temperature scenario
        - perils: List of perils the bond is exposed to
        - issue_num: Issuance number from the same 6-digit CUSIP issuer
        - peril_group: Bonds with same 6-digit CUSIP-issue_num-peril_group combination are different tranches of same issuance covering different layers of exactly same perils
        - tranche: Tranche number of a bond in a given 6-digit CUSIP-issue_num-peril_group combination. Riskiest tranche is 1.
        - tranche: Tranche number of a bond in a given 6-digit CUSIP-issue_num-peril_group combination. Riskiest tranche is 1.
        - el_[peril]: E.g. el_north_america_cyclone. Peril-specific expected loss. Variables with _wsst indicate expected losses in Warm Sea Surface Temperature scenario.
        - ap_[peril]: E.g. ap_north_america_cyclone. Peril-specific attachment probability. Variables with _wsst indicate attachment probabilities in Warm Sea Surface Temperature scenario.
        - ep_[peril]: E.g. ep_north_america_cyclone. Peril-specific exhaustion probability. Variables with _wsst indicate exhaustion probabilities in Warm Sea Surface Temperature scenario.

- secondary.csv
    - Contains quarterly secondary market data on cat bonds
    - Primary key: CUSIP9, date
	- Variables:
        - size: Issuance amount in USD. Non-USD bonds are converted using spot rates on date. Hence, for these bonds size can change over the life of the bond but for most bonds this is a static variable.
        - spread: Spread over benchmark rate for variable reset bonds, spread can change over the life of the bond but for most bonds this is a static variable.
        - attachment_prob: Attachment probability. For variable reset bonds, this can change over the life of the bond but for most bonds this is a static variable.
        - expected_loss: Expected loss. For variable reset bonds, this can change over the life of the bond but for most bonds this is a static variable.
        - exhaustion_prob: Exhaustion probability. For variable reset bonds, this can change over the life of the bond but for most bonds this is a static variable.
        - attachment_prob_wsst: Attachment probability in Warm Sea Surface Temperature scenario.
        - expected_loss_wsst: Expected loss in Warm Sea Surface Temperature scenario.
        - exhaustion_prob_wsst: Exhaustion probability in Warm Sea Surface Temperature scenario.
        - turnover: Quarterly turnover calculate from TRACE data. Primary market transactions are excluded.
        - n_trades: Quarterly number of trades from TRACE. Primary market transactions are excluded.
        - trading_interval: Average quarterly trading interval (in days) from TRACE.
        - bmk_yield: Yield on bond-specific benchmark rate.
        - rf: 12-month Box rate of Van Binsbergen, Diamond, and Grotteria (2022).
        - sheet_price: Discount margin from broker dealer pricing sheets.
        - current_maturity: Maturity date variable that reflects most recent information about bond's maturity date at 'date'. Takes into account calls and maturity extensions.
        - sheet_yield: Bond yield, defined as sheet_price + bmk_yield / 100.
        - act_yield: Bond yield, calculated from TRACE price.
		- sheet_yield_usd: USD-hedged sheet_yield.
        - act_yield_usd: USD-hedged act_yield.
        - distress_fl: "Distress" flag from secondary market pricing sheet of Lane Financial LLC.
        - rating_change: Equals 1 if at least one credit rating agency has changed bond's credit rating.
        - creditwatch: Equals 1 if bond is under credit watch by any agency.
        - triggered: Equals 1 if bond has triggered by a disaster.
        - dealer_spread: Quarterly average of daily differences between dealer buy and sell transactions from TRACE.

- ts.csv
    - Contains annual (June) time series variables about cat bond market size and aum
    - Primary key: date
	- Variables:
	    - aum: Insurance Linked Fund AUM (USD billions) from https://insurancelinked.com/
	    - alternative_capital: Size of the alternative capital sector (USD billions) from Exhibit 13 of Aon Benfield 2018: Insurance-Linked Securities - Alternative Capital Fortifies Its Position
	    - var_m_sheet_cyclone: Cyclone portfolio variance from the simulation model
	    - var_m_sheet_earthquake: Earthquake portfolio variance from the simulation model

- betas.csv
    - Contains quarterly beta estimates constructed using real actuarial probabilities
    - Primary key: CUSIP9, date
	- Betas are constructed using several methodologies (see simulate.py). Main estimates have suffix "_sheet". For each methodology, three variables are present:
        - beta: Simulated beta estimate
        - var: Simulated return variance
        - var_m: Simulated variance of the market portfolio (same for all bonds for a given date)

- macro_effects.csv
    - Contains country-year level data on macroeconomic variables (from Jordà-Schularick-Taylor Macrohistory Database, see https://www.macrohistory.net/database/ for documentation and variable definition),
	  and aggregate natural disaster damanges from EM-DAT International Disaster Database (https://www.emdat.be/).
    - Primary key: year, iso
	- Variables:
	    - Various macroeconomic variables from Jordà-Schularick-Taylor Macrohistory Database
        - total_damage: Total Damage ('000 US$) aggregated at country-year level

- cat_vs_others.csv
    - Contains monthly returns and index values for various indices
    - Primary key: mdate
	- Variables:
        - mmret: CRSP value-weighted index return
        - ilsfund_ret: Return on Eurekahedge ILS Advisers Index
        - ix_hy: value of high-yield corporate bond index
        - ix_swissre: value of Swiss Re Global Cat Bond Total Return Index
